package com.example.demo.dao

import com.example.demo.bean.UserBean
import org.apache.ibatis.annotations.*

@Mapper
interface UserMapper {

    @Select("select * from userinfo where username = #{username} and pwd = #{pwd}")
    fun login(@Param("username") username:String, @Param("pwd")pwd:String): UserBean?

    @Insert("insert into userinfo (username,pwd,phone) value (#{username},#{pwd},#{phone})")
    fun register(@Param("username") username:String, @Param("pwd")pwd:String, @Param("phone")phone:String): Boolean?

    @Delete("delete from userinfo where username = #{username}")
    fun delete(@Param("username") username:String): Boolean?

    @Update("update userinfo SET phone = #{phone} WHERE id = 2")
    fun update(@Param("phone") phone:String): Boolean?
}